Skip to content

Cookiecutter pre-commit workflow (fix flake8) - #3

Merged
sbillinge merged 11 commits into
diffpy:mainfrom
bobleesj:precommit
Aug 8, 2024
Merged

sbillinge merged 11 commits into
diffpy:mainfrom
bobleesj:precommit

Conversation

@bobleesj

@bobleesj bobleesj commented Aug 8, 2024

Copy link
Copy Markdown
Contributor

Fixed all flake8 errors. Local pre-commit passes.

  • Fix F401 - remove imported but not used

  • Fix E501 - fix line too long problems

  • Fix F821 - import setuptools

  • Fix E741 - clarify variable name

  • Fix E722 - do not use bare 'except'

  • Reviewed PR

@sbillinge

@sbillinge sbillinge left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please see comments.

Comment thread diffpy/nmf_mapping/nmf_mapping/main.py Outdated
l, h = map(int, s.split(","))
return l, h
except:
except Exception:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is looking a bit ugly. Why are we changing Exception into TypeError? I expect there is a better way of doing this.

@@ -237,7 +239,7 @@ def component_plot(df_components, xrd=False, x_units=None, show=True):
"""
try:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is also a bit ugly. It think that we just need to fix the requirements so that this works and remove the try/except.

try:
plt.style.use(bg_mpl_style)
except:
except Exception:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above.

try:
plt.style.use(bg_mpl_style)
except:
except Exception:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above. Also, why is this happening multiple times. Don't we want to just set this at the top of the file and be done with it?

Comment thread setup.py Resolved
@bobleesj

bobleesj commented Aug 8, 2024

Copy link
Copy Markdown
Contributor Author

@sbillinge Please review!

@sbillinge sbillinge left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please see comments.

Comment thread requirements/run.txt Resolved
@@ -34,11 +34,14 @@ def main(args=None):
parser = ArgumentParser(prog="nmf_mapping", description=_BANNER, formatter_class=RawTextHelpFormatter)

def tup(s):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is probably a better method for handling this with argparse. Also, it seems that the issue here would be that after parsing the string, they should be two integers, but why not just use the argparse ways of handling this?

@sbillinge sbillinge left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still don't like how the arg parsing was fixed but I will merge and fix it. Please can you make an issue and assign it to me? Thanks.

@bobleesj

bobleesj commented Aug 9, 2024

Copy link
Copy Markdown
Contributor Author

I still don't like how the arg parsing was fixed but I will merge and fix it. Please can you make an issue and assign it to me? Thanks.

@sbillinge I made an issue #4. But not sure if I have the rights to add assignees:

Screenshot 2024-08-08 at 9 02 11 PM

@bobleesj
bobleesj deleted the precommit branch August 9, 2024 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants